package com.ope.web.controller.chainresponsibility;

import com.ope.web.model.DTO.ProcessMointorRequestBody;
import java.util.Arrays;


public interface TopicAnalysis {

    /**
     * 设备下一处理
     *
     * @param processMointorRequestBody processMointorRequestBody
     */
    void decode(ProcessMointorRequestBody processMointorRequestBody);

    /**
     * 设备下一处理
     * @return   String[]
     **/
    String[] getServiceTypes();

    /**
     * 默认以服务名称定位解析类
     * @param processMointorRequestBody  processMointorRequestBody
     * @param serviceModel serviceModel
     * @return true
     */
    default Boolean matchDecoder(ProcessMointorRequestBody processMointorRequestBody, String serviceModel) {
        String[] serviceTypes = getServiceTypes();
        if (Arrays.asList(serviceTypes).contains(serviceModel)) {
            return true;
        }
        return false;
    }

    /**
     * 设备下一处理
     *
     * @param next next
     */
    void setNext(TopicAnalysis next);

    /**
     * 设备下一处理
     * @return  TopicAnalysis TopicAnalysis
     */
    TopicAnalysis getNext();
}
